﻿@inherits Blazorise.BarDropdownToggle
@if ( ParentBar?.Mode == BarMode.Horizontal )
{
    <button @ref="@ElementRef" id="@ElementId" class="@ClassNames" style="@StyleNames" role="button" aria-expanded="@(ParentBarDropdownState?.Visible.ToString().ToLowerInvariant())" @onclick="@ClickHandler" @attributes="@Attributes" @onmouseenter="@ParentBarDropdown.OnMouseEnterHandler" @onmouseleave="@ParentBarDropdown.OnMouseLeaveHandler">
        <span>@ChildContent</span>
        <svg class="b-bar-dropdown-toggle-arrow w-4 h-4 ml-1" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
    </button>
}
else
{
    <a @ref="@ElementRef" id="@ElementId" class="@ClassNames" style="@StyleNames" role="button" tabindex="0" @onclick="@ClickHandler" @onkeydown="@KeyDownHandler" @attributes="@Attributes" @onmouseenter="@ParentBarDropdown.OnMouseEnterHandler" @onmouseleave="@ParentBarDropdown.OnMouseLeaveHandler">
        @ChildContent
    </a>
}
@code {
    /// <summary>
    /// Gets or sets the reference to the parent <see cref="Bar"/> component.
    /// </summary>
    [CascadingParameter] protected Bar ParentBar { get; set; }
}